﻿public partial struct EntitasVec2
{
    public float x;
    public float y;
    public static EntitasVec2 Zero { get { return new EntitasVec2(0, 0); } private set { } }
    public EntitasVec2(float x, float y)
    {
        this.x = x;
        this.y = y;

    }
    public void Setvector(float Newx, float NewY)
    {
        x = Newx;
        y = NewY;
       
    }

    public override bool Equals(object obj)
    {
        if (obj is EntitasVec2)
        {
            EntitasVec2 vec = (EntitasVec2)obj;
            if (vec == this)
                return true;
            else return false;
        }
        else return false;
    }

    public override string ToString()
    {
        return ("X=" + x + " Y=" + y);
    }
    public override int GetHashCode()
    {
        var hashCode = 373119288;
        hashCode = hashCode * -1521134295 + base.GetHashCode();
        hashCode = hashCode * -1521134295 + x.GetHashCode();
        hashCode = hashCode * -1521134295 + y.GetHashCode();
        return hashCode;
    }

    public static bool operator ==(EntitasVec2 a, EntitasVec2 b)
    {
        if (a.x == b.x && a.y == b.y)
            return true;
        else return false;
    }

    public static bool operator !=(EntitasVec2 a, EntitasVec2 b)
    {
        if (a.x != b.x || a.y != b.y)
            return true;
        else return false;
    }

    public static EntitasVec2 operator +(EntitasVec2 a, EntitasVec2 b)
    {
        var sum = new EntitasVec2
        {
            x = a.x + b.x,
            y = a.y + b.y,
        };
        return sum;
    }

    public static EntitasVec2 operator -(EntitasVec2 a, EntitasVec2 b)
    {
        var difference = new EntitasVec2
        {
            x = a.x - b.x,
            y = a.y - b.y,
        };
        return difference;
    }

    public static EntitasVec2 operator *(EntitasVec2 a, float value)
    {
        a.x *= value;
        a.y *= value;
        return a;
    }

    public static EntitasVec2 operator /(EntitasVec2 a, float value)
    {
        a.x /= value;
        a.y /= value;
        return a;
    }
}


